package com.zpf.dao.impl;

import com.zpf.dao.ProFileDao;
import com.zpf.pojo.Profile;
import com.zpf.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class ProFileDaoImpl implements ProFileDao {
    private QueryRunner queryRunner = new QueryRunner(DBUtils.getDateSource());
    @Override
    public List<Profile> getAll() {
        String sql= "select * from profile";
        try {
            List<Profile> query = queryRunner.query(sql, new BeanListHandler<>(Profile.class));
            return query;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
